﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.TeamFoundation.TestManagement.Client;

namespace TestStepsEditor
{
    public class SimpleStep
    {
        public SimpleStep()
        {
            Image = null;
            Title = String.Empty;
            ExpectedResult = String.Empty;
            SharedStep = false;
            GroupByIndexer = 0;
            SharedStepNumber = 0;
            Attachment = null;
        }

        public SimpleStep(DataGridViewImageColumn image, string title, string expectedResult, bool sharedStep,
                          int sharedStepNumber, int groubByIndexer,
                          IAttachmentCollection attachment)
        {
            Image = null;
            Title = title.Replace("\n", "\r\n");
            ExpectedResult = expectedResult.Replace("\n", "\r\n");
            SharedStep = sharedStep;
            GroupByIndexer = groubByIndexer;
            SharedStepNumber = sharedStepNumber;
            Attachment = attachment;
        }

        public SimpleStep(DataGridViewImageColumn image, string title, string expectedResult, bool sharedStep,
                          int sharedStepNumber, int groubByIndexer,
                          IAttachmentCollection attachment, bool refactorText)
        {
            Image = null;
            if (refactorText)
            {
                Title = title.Replace("\n", "\r\n");
                ExpectedResult = expectedResult.Replace("\n", "\r\n");
            }
            else
            {
                Title = title;
                ExpectedResult = expectedResult;
            }
            SharedStep = sharedStep;
            GroupByIndexer = groubByIndexer;
            SharedStepNumber = sharedStepNumber;
            Attachment = attachment;
        }

        public Image Image { get; set; }
        public string Title { get; set; }
        public string ExpectedResult { get; set; }
        public bool SharedStep { get; set; }
        public int GroupByIndexer { get; set; }
        public int SharedStepNumber { get; set; }
        public IAttachmentCollection Attachment { get; set; }
    }
}